package _021_10_6

func combine(n int, k int) [][]int {
	result := make([][]int, 0)
	result = append(result, []int{})
	for i := 1; i <= n; i++ {
		size := len(result)
		for j := 0; j < size; j++ {
			temp := make([]int, 0)
			for z := 0; z < len(result[j]); z++ {
				temp = append(temp, result[j][i])
			}
			temp = append(temp, i)
			result = append(result, temp)
		}
	}
	newResult := make([][]int, 0)
	for i := 0; i < len(result); i++ {
		if len(result[i]) == k {
			newResult = append(newResult, result[i])
		}
	}
	return newResult
}
